<?php
class Mail extends CI_Controller {
	public function __construct() {
		parent::__construct ();
		// 登录校验
		$this->common->check_login_admin ();
		$this->load->helper ( array (
				'form',
				'url' 
		) );
	}
	
	// 留言
	public function index() {
		$this->load->model ( 'message_model' );
		$data ['result'] = $this->message_model->message_list ();
		
		$data ['left'] = $this->load->view ( 'admin/left', '', TRUE );
		$data ['menu'] = $this->load->view ( 'admin/menu', '', TRUE );
		
		$this->load->view ( 'admin/mail', $data );
	}
	
	// 回复
	public function reply() {
		$this->load->model ( 'message_model' );
		$result = $this->message_model->reply ( $_SESSION ['admin'] ['id'] );
		
		if ($result) {
			exit ( $this->common->alert_msg_url ( '发布成功', site_url ( 'admin/mail' ) ) );
		} else {
			exit ( $this->common->alert_msg_goback ( '发布失败' ) );
		}
	}
}